package com.yakumosakura.yakumoblade.registry.slashblade;


import com.google.common.base.CaseFormat;
import com.yakumosakura.yakumoblade.Yakumoblade;
import com.yakumosakura.yakumoblade.entity.*;
import com.yakumosakura.yakumoblade.entity.drive.BigDriveEnity;
import com.yakumosakura.yakumoblade.entity.drive.StarDriveEnity;
import com.yakumosakura.yakumoblade.entity.exer.EntityNRBlisteringSword;
import com.yakumosakura.yakumoblade.entity.exer.EntitySpiralSwords;
import com.yakumosakura.yakumoblade.entity.exer.SwordRainEntityFire;
import com.yakumosakura.yakumoblade.entity.hexgram.a.HexGramSumonSwordEntity;
import com.yakumosakura.yakumoblade.entity.hexgram.b.DragonHexGramStar;
import com.yakumosakura.yakumoblade.entity.hexgram.b.SwordRainEntityDragon;
import com.yakumosakura.yakumoblade.entity.hexgram.neo.DragonHexGramEntity;
import com.yakumosakura.yakumoblade.entity.hexgram.neo.FoxHexGramExEntity;
import com.yakumosakura.yakumoblade.entity.hexgram.neo.LaserCircleEntity;
import com.yakumosakura.yakumoblade.entity.hexgram.old.FoxSumonSwordEntity;
import com.yakumosakura.yakumoblade.entity.hexgram.old.StarEntityFox;
import com.yakumosakura.yakumoblade.entity.hexgram.old.SwordRainEntityFox;
import com.yakumosakura.yakumoblade.entity.star.StarRiderEntity;
import com.yakumosakura.yakumoblade.entity.touhou.YuYuKoSpiralSwordsEntity;
import com.yakumosakura.yakumoblade.entity.touhou.YukariEntity;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegisterEvent;

import static com.yakumosakura.yakumoblade.Yakumoblade.MODID;
public class YAEntitiesRegistry {
    //实体注册表
    public static final ResourceLocation WitherAttackLoc = new ResourceLocation(MODID, classToString(WitherAttackEntity.class));
    public static final ResourceLocation SoulEdgeLoc = new ResourceLocation(MODID, classToString(SoulEdgeEntity.class));
    public static final ResourceLocation WitherSummonSwordLoc = new ResourceLocation(MODID, classToString(WitherSummonSwordEntity.class));
    public static final ResourceLocation SoulEdgeBLoc = new ResourceLocation(MODID, classToString(SoulEdgeEntityButerfly.class));
    public static final ResourceLocation BlackSlashLoc = new ResourceLocation(MODID, classToString(BlackSlashEntity.class));
    public static final ResourceLocation GigantjudgementCutLoc = new ResourceLocation(MODID, classToString(GigantjudgementCut.class));
    public static final ResourceLocation SumonSwordEntityLoc = new ResourceLocation(MODID, classToString(FoxSumonSwordEntity.class));
    public static final ResourceLocation StarEntityLoc = new ResourceLocation(MODID, classToString(StarEntityFox.class));
    public static final ResourceLocation SwordRainEntityLoc = new ResourceLocation(MODID, classToString(SwordRainEntityFox.class));
    public static final ResourceLocation SwordRainEntityDragonLoc = new ResourceLocation(MODID, classToString(SwordRainEntityDragon.class));
    public static final ResourceLocation StarEntityDragonLoc = new ResourceLocation(MODID, classToString(DragonHexGramStar.class));
    public static final ResourceLocation getSummonSwordLoc = new ResourceLocation(MODID, classToString(SummonSwordEntity.class));
    public static final ResourceLocation BigDriveEnityLoc = new ResourceLocation(MODID, classToString(BigDriveEnity.class));
    public static final ResourceLocation SwordRainEntityFireLoc = new ResourceLocation(MODID, classToString(SwordRainEntityFire.class));
    public static final ResourceLocation BlueFoxLoc = new ResourceLocation(MODID, classToString(EntitySpiralSwords.class));
    public static final ResourceLocation HexGramSumonSwordLoc = new ResourceLocation(MODID, classToString(HexGramSumonSwordEntity.class));
    public static final ResourceLocation StarDriveLoc = new ResourceLocation(MODID, classToString(StarDriveEnity.class));
    public static final ResourceLocation EntityNRBlisteringSwordLoc = new ResourceLocation(MODID, classToString(EntityNRBlisteringSword.class));
    public static final ResourceLocation YuYuKoSpiralSwordsEntityLoc = new ResourceLocation(MODID, classToString(YuYuKoSpiralSwordsEntity.class));
    public static final ResourceLocation FoxHexGramExEntityLoc = new ResourceLocation(MODID, classToString(FoxHexGramExEntity.class));
    public static final ResourceLocation YukariEntityLoc = new ResourceLocation(MODID, classToString(YukariEntity.class));
    public static final ResourceLocation DragonHexGramEntityLoc = new ResourceLocation(MODID, classToString(DragonHexGramEntity.class));
    public static final ResourceLocation LaserCircleLoc = new ResourceLocation(MODID, classToString(LaserCircleEntity.class));
    public static final ResourceLocation StarRiderLoc = new ResourceLocation(MODID, classToString(StarRiderEntity.class));



    public static EntityType<WitherAttackEntity> wither_attack;
    public static EntityType<SoulEdgeEntity> soul_edge;
    public static EntityType<WitherSummonSwordEntity> wither_summon_sword;
    public static EntityType<SoulEdgeEntityButerfly> SoulEdgeB;//反魂蝶
    public static EntityType<BlackSlashEntity> BlackSlash;//黑斩
    public static EntityType<GigantjudgementCut> GigantjudgementCuts;
    public static EntityType<FoxSumonSwordEntity> SumonSwordentityFox;
    public static EntityType<StarEntityFox> starEntity;
    public static EntityType<SwordRainEntityFox> swordRainEntity;
    public static EntityType<SwordRainEntityDragon> swordRainEntityDragon;
    public static EntityType<DragonHexGramStar> starEntityDragon;
    public static EntityType<SummonSwordEntity> SummonSword;
    public static EntityType<BigDriveEnity> BigDrive;
    public static EntityType<SwordRainEntityFire> swordRainFire;
    public static EntityType<EntitySpiralSwords> BlueFox;
    public static EntityType<HexGramSumonSwordEntity> HexGramSumonSword;
    public static EntityType<StarDriveEnity> StarDrive;
    public static EntityType<EntityNRBlisteringSword> EntityNRBlisteringsword;
    public static EntityType<YuYuKoSpiralSwordsEntity> YuYuKoSpiralSwords;
    public static EntityType<FoxHexGramExEntity> FoxHexGramEx;
    public static EntityType<YukariEntity> Yukari;
    public static EntityType<DragonHexGramEntity> DragonHexGramEntitys;
    public static EntityType<LaserCircleEntity> LaserCircle;
    public static EntityType<StarRiderEntity> StarRider;

    public static void register(RegisterEvent event){
        Yakumoblade.LOGGER.debug("register entity type");
        event.register(ForgeRegistries.Keys.ENTITY_TYPES, helper ->
        {
            {
                EntityType<WitherAttackEntity> entity = wither_attack = EntityType.Builder
                        .of(WitherAttackEntity::new, MobCategory.MISC)
                        .sized(0.9F, 0.9F)
                        .setTrackingRange(4)
                        .setUpdateInterval(20).setCustomClientFactory(WitherAttackEntity::createInstance)
                        .build(WitherAttackLoc.toString());
                helper.register(WitherAttackLoc, entity);
            }

            {
                EntityType<SoulEdgeEntity> entity = soul_edge = EntityType.Builder
                        .of(SoulEdgeEntity::new, MobCategory.MISC)
                        .sized(0.9F, 0.9F)
                        .setTrackingRange(4)
                        .setUpdateInterval(20).setCustomClientFactory(SoulEdgeEntity::createInstance)
                        .build(SoulEdgeLoc.toString());
                helper.register(SoulEdgeLoc, entity);
            }

            {
                EntityType<WitherSummonSwordEntity> entity = wither_summon_sword = EntityType.Builder
                        .of(WitherSummonSwordEntity::new, MobCategory.MISC)
                        .sized(0.9F, 0.9F)
                        .setTrackingRange(4)
                        .setUpdateInterval(20).setCustomClientFactory(WitherSummonSwordEntity::createInstance)
                        .build(WitherSummonSwordLoc.toString());
                helper.register(WitherSummonSwordLoc, entity);
            }
            {
                EntityType<SoulEdgeEntityButerfly> entity = SoulEdgeB = EntityType.Builder
                        .of(SoulEdgeEntityButerfly::new, MobCategory.MISC)
                        .sized(0.9F, 0.9F)
                        .setTrackingRange(4)
                        .setUpdateInterval(20).setCustomClientFactory(SoulEdgeEntityButerfly::createInstance)
                        .build(SoulEdgeBLoc.toString());
                helper.register(SoulEdgeBLoc, entity);
            }
            {
                EntityType<BlackSlashEntity> entity = BlackSlash = EntityType.Builder
                        .of(BlackSlashEntity::new, MobCategory.MISC)
                        .sized(0.9F, 0.9F)
                        .setTrackingRange(4)
                        .setUpdateInterval(20).setCustomClientFactory(BlackSlashEntity::createInstance)
                        .build(BlackSlashLoc.toString());
                helper.register(BlackSlashLoc, entity);
            }
            {
                EntityType<GigantjudgementCut> entity = GigantjudgementCuts = EntityType.Builder
                        .of(GigantjudgementCut::new, MobCategory.MISC)
                        .sized(0.9F, 0.9F)
                        .setTrackingRange(4)
                        .setUpdateInterval(20).setCustomClientFactory(GigantjudgementCut::createInstance)
                        .build(GigantjudgementCutLoc.toString());
                helper.register(GigantjudgementCutLoc, entity);
            }
            {
                EntityType<FoxSumonSwordEntity> entity = SumonSwordentityFox = EntityType.Builder
                        .of(FoxSumonSwordEntity::new, MobCategory.MISC)
                        .sized(0.9F, 0.9F)
                        .setTrackingRange(4)
                        .setUpdateInterval(20).setCustomClientFactory(FoxSumonSwordEntity::createInstance)
                        .build(SumonSwordEntityLoc.toString());
                helper.register(SumonSwordEntityLoc, entity);
            }
            {
                EntityType<StarEntityFox> entity = starEntity = EntityType.Builder
                        .of(StarEntityFox::new, MobCategory.MISC)
                        .sized(0.9F, 0.9F)
                        .setTrackingRange(4)
                        .setUpdateInterval(20).setCustomClientFactory(StarEntityFox::createInstance)
                        .build(StarEntityLoc.toString());
                helper.register(StarEntityLoc, entity);
            }
            {
                EntityType<SwordRainEntityFox> entity = swordRainEntity = EntityType.Builder
                        .of(SwordRainEntityFox::new, MobCategory.MISC)
                        .sized(0.9F, 0.9F)
                        .setTrackingRange(4)
                        .setUpdateInterval(20).setCustomClientFactory(SwordRainEntityFox::createInstance)
                        .build(SwordRainEntityLoc.toString());
                helper.register(SwordRainEntityLoc, entity);
            }
            {
                EntityType<SwordRainEntityDragon> entity = swordRainEntityDragon = EntityType.Builder
                        .of(SwordRainEntityDragon::new, MobCategory.MISC)
                        .sized(0.9F, 0.9F)
                        .setTrackingRange(4)
                        .setUpdateInterval(20).setCustomClientFactory(SwordRainEntityDragon::createInstance)
                        .build(SwordRainEntityDragonLoc.toString());
                helper.register(SwordRainEntityDragonLoc, entity);
            }
            {
                EntityType<DragonHexGramStar> entity = starEntityDragon = EntityType.Builder
                        .of(DragonHexGramStar::new, MobCategory.MISC)
                        .sized(0.9F, 0.9F)
                        .setTrackingRange(4)
                        .setUpdateInterval(20).setCustomClientFactory(DragonHexGramStar::createInstance)
                        .build(StarEntityDragonLoc.toString());
                helper.register(StarEntityDragonLoc, entity);
            }
            {
                EntityType<SummonSwordEntity> entity = SummonSword = EntityType.Builder
                        .of(SummonSwordEntity::new, MobCategory.MISC)
                        .sized(0.9F, 0.9F)
                        .setTrackingRange(4)
                        .setUpdateInterval(20).setCustomClientFactory(SummonSwordEntity::createInstance)
                        .build(getSummonSwordLoc.toString());
                helper.register(getSummonSwordLoc, entity);
            }
            {
                EntityType<BigDriveEnity> entity = BigDrive = EntityType.Builder
                        .of(BigDriveEnity::new, MobCategory.MISC)
                        .sized(0.9F, 0.9F)
                        .setTrackingRange(4)
                        .setUpdateInterval(20).setCustomClientFactory(BigDriveEnity::createInstance)
                        .build(BigDriveEnityLoc.toString());
                helper.register(BigDriveEnityLoc, entity);
            }
            {
                EntityType<SwordRainEntityFire> entity = swordRainFire = EntityType.Builder
                        .of(SwordRainEntityFire::new, MobCategory.MISC)
                        .sized(0.9F, 0.9F)
                        .setTrackingRange(4)
                        .setUpdateInterval(20).setCustomClientFactory(SwordRainEntityFire::createInstance)
                        .build(SwordRainEntityFireLoc.toString());
                helper.register(SwordRainEntityFireLoc, entity);
            }
            {
                EntityType<EntitySpiralSwords> entity = BlueFox = EntityType.Builder
                        .of(EntitySpiralSwords::new, MobCategory.MISC)
                        .sized(0.9F, 0.9F)
                        .setTrackingRange(4)
                        .setUpdateInterval(20).setCustomClientFactory(EntitySpiralSwords::createInstance)
                        .build(BlueFoxLoc.toString());
                helper.register(BlueFoxLoc, entity);
            }
            {
                EntityType<HexGramSumonSwordEntity> entity = HexGramSumonSword = EntityType.Builder
                        .of(HexGramSumonSwordEntity::new, MobCategory.MISC)
                        .sized(0.9F, 0.9F)
                        .setTrackingRange(4)
                        .setUpdateInterval(20).setCustomClientFactory(HexGramSumonSwordEntity::createInstance)
                        .build(HexGramSumonSwordLoc.toString());
                helper.register(HexGramSumonSwordLoc, entity);
            }
            {
                EntityType<StarDriveEnity> entity = StarDrive = EntityType.Builder
                        .of(StarDriveEnity::new, MobCategory.MISC)
                        .sized(0.9F, 0.9F)
                        .setTrackingRange(4)
                        .setUpdateInterval(20).setCustomClientFactory(StarDriveEnity::createInstance)
                        .build(StarDriveLoc.toString());
                helper.register(StarDriveLoc, entity);
            }
            {
                EntityType<EntityNRBlisteringSword> entity = EntityNRBlisteringsword = EntityType.Builder
                        .of(EntityNRBlisteringSword::new, MobCategory.MISC)
                        .sized(0.9F, 0.9F)
                        .setTrackingRange(4)
                        .setUpdateInterval(20).setCustomClientFactory(EntityNRBlisteringSword::createInstance)
                        .build(EntityNRBlisteringSwordLoc.toString());
                helper.register(EntityNRBlisteringSwordLoc, entity);
            }
            {
                EntityType<YuYuKoSpiralSwordsEntity> entity = YuYuKoSpiralSwords = EntityType.Builder
                        .of(YuYuKoSpiralSwordsEntity::new, MobCategory.MISC)
                        .sized(0.9F, 0.9F)
                        .setTrackingRange(4)
                        .setUpdateInterval(20).setCustomClientFactory(YuYuKoSpiralSwordsEntity::createInstance)
                        .build(YuYuKoSpiralSwordsEntityLoc.toString());
                helper.register(YuYuKoSpiralSwordsEntityLoc, entity);
            }
            {
                EntityType<FoxHexGramExEntity> entity = FoxHexGramEx = EntityType.Builder
                        .of(FoxHexGramExEntity::new, MobCategory.MISC)
                        .sized(0.9F, -100F)
                        .setTrackingRange(4)
                        .setUpdateInterval(20).setCustomClientFactory(FoxHexGramExEntity::createInstance)
                        .build(FoxHexGramExEntityLoc.toString());
                helper.register(FoxHexGramExEntityLoc, entity);
            }
            {
                EntityType<YukariEntity> entity = Yukari = EntityType.Builder
                        .of(YukariEntity::new, MobCategory.MISC)
                        .sized(0.9F, 0.9F)
                        .setTrackingRange(4)
                        .setUpdateInterval(20).setCustomClientFactory(YukariEntity::createInstance)
                        .build(YukariEntityLoc.toString());
                helper.register(YukariEntityLoc, entity);
            }
            {
                EntityType<DragonHexGramEntity> entity = DragonHexGramEntitys = EntityType.Builder
                        .of(DragonHexGramEntity::new, MobCategory.MISC)
                        .sized(0.9F, -100F)
                        .setTrackingRange(4)
                        .setUpdateInterval(20).setCustomClientFactory(DragonHexGramEntity::createInstance)
                        .build(DragonHexGramEntityLoc.toString());
                helper.register(DragonHexGramEntityLoc, entity);
            }
            {
                EntityType<LaserCircleEntity> entity = LaserCircle = EntityType.Builder
                        .of(LaserCircleEntity::new, MobCategory.MISC)
                        .sized(0.9F, -100F)
                        .setTrackingRange(4)
                        .setUpdateInterval(20).setCustomClientFactory(LaserCircleEntity::createInstance)
                        .build(LaserCircleLoc.toString());
                helper.register(LaserCircleLoc, entity);
            }
            {
                EntityType<StarRiderEntity> entity = StarRider = EntityType.Builder
                        .of(StarRiderEntity::new, MobCategory.MISC)
                        .sized(0.9F, 0.9F)
                        .setTrackingRange(4)
                        .setUpdateInterval(20).setCustomClientFactory(StarRiderEntity::createInstance)
                        .build(StarRiderLoc.toString());
                helper.register(StarRiderLoc, entity);
            }
        });

    }
    private static String classToString(Class<? extends Entity> entityClass)
    {
        return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, entityClass.getSimpleName())
                .replace("entity_", "");
    }

}
